<template>
  <router-link :to="props.router" class="module-card">
    <i :class="props.icon" :style="{color: props.color}"></i>

    <div class="content">
      <span class="title">{{ props.title }}</span>
      <span class="summary">{{ props.subTitle }}</span>
    </div>
  </router-link>
</template>

<script setup lang="ts">
import { defineProps } from 'vue'

const props = defineProps({
  icon: {
    type: String,
    required: true
  },
  color: {
    type: String,
    required: true
  },
  title: {
    type: String,
    required: true
  },
  subTitle: {
    type: String,
    required: true
  },
  router: {
    type: String,
    required: true
  }
})
</script>

<style lang="scss" scoped>
$module-card-height: 80px;

.module-card {
  background-color: var(--color-card-bg);
  border: 1px solid var(--el-color-primary);
  border-radius: 10px;
  padding: 10px;

  height: $module-card-height;
  display: grid;
  grid-template-columns: 45px 1fr;
  gap: 10px;

  .iconfont {
    font-size: 40px;
    justify-self: center;
    align-self: center;
  }

  .content {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 5px;

    .title {
      font-size: 1.2rem;
    }

    .summary {
      font-size: 1rem;
      color: darkgrey;
    }
  }
}
</style>
